package net.easyjava.base.service;

import net.easyjava.base.Exception.ServiceException;
import net.easyjava.base.bean.ArticleBean;
import net.easyjava.base.bean.cache.ArticleCacheBean;
import net.easyjava.tools.page.Page;

import java.util.Map;

/**
 * Created by wenxiaoning on 15/12/18.
 */
public interface ArticleService {
    /**
     * 保存文章
     * @param articleBean
     * @return
     */
    public ArticleBean save(ArticleBean articleBean)throws ServiceException;

    /**
     * 保存缓存类
     * @param articleCacheBean
     * @return
     * @throws ServiceException
     */
    public void saveCache(ArticleCacheBean articleCacheBean) throws ServiceException;

    /**
     * 查找一个篇文章
     * @param id
     * @return
     */
    public ArticleBean find(String id) throws ServiceException;

    /**
     * 查找缓存类
     * @param id
     * @return
     * @throws ServiceException
     */
    public ArticleCacheBean findCache(String id) throws ServiceException;

    /**
     * 查找文章列表
     * @param params
     * @param pageNum
     * @param pageSize
     * @return
     */
    public Page<ArticleBean> findList(Map<String,Object> params ,int pageNum,int pageSize) throws ServiceException;

    public Page<ArticleBean> findAllList();
    /**
     * 删除文章
     * @param id
     * @return
     */
    public boolean delete(String id) throws ServiceException;

    /**
     * 修改文章
     * @param articleBean
     * @return
     */
    public ArticleBean update(ArticleBean articleBean)throws ServiceException;


    /**
     * 删除缓存类
     * @param id
     * @throws ServiceException
     */
    public void deleteCache(String id) throws ServiceException;

    /**
     * 清空缓存
     */
    public void removeCache();

    /**
     * 获取全部类型列表
     * @param pageNum
     * @param pageSize
     * @return
     */
    public Page<ArticleCacheBean> findCacheAllList(int pageNum,int pageSize);

    /**
     * 根据albumId获取列表
     * @param albumId
     * @param pageNum
     * @param pageSize
     * @return
     */
    public Page<ArticleCacheBean> findCacheList(int albumId,int pageNum,int pageSize);

}
